﻿using System;

using Common.Base;

namespace Common.Extensions
{
    public static class PositionExtension
    {
        public static int Dot(this Position pos, Position op)
        {
            return (pos.X * op.X) + (pos.Y * op.Y);
        }

        public static float Scalar(this Position pos)
        {
            return (float)Math.Sqrt((pos.X * pos.X) + (pos.Y + pos.Y));
        }

        public static float Distance(this Position pos, Position op)
        {
            return (pos - op).Abs().Scalar();
        }

        public static Position Abs(this Position pos)
        {
            return new Position(Math.Abs(pos.X), Math.Abs(pos.Y));
        }
    }
}